import styles from './index.less';
import SecondPage from './secondPage';
import { connect, Dispatch, useModel, withRouter } from 'umi';

function DvaPage({ todo, dispatch }) {
  return (
    <div>
      <h1
        className={styles.title}
        onClick={() => {
          dispatch({ type: 'todo/query', payload: 'changedName' });
        }}
      >
        {todo.name}
      </h1>
      <SecondPage />
    </div>
  );
}

export default connect(({ todo }: { todo: any }) => ({
  todo,
}))(DvaPage);
